<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:c="http://java.sun.com/jsp/jstl/core"
      xmlns:h="http://java.sun.com/jsf/html">

    <body>

        <ui:composition template="./../../WEB-INF/templates/Template.xhtml">

            <ui:define name="content">
                <div class= "body-content" >
                    <div class ="right-cont">   
                        <c:set var="list" value= "${admin_CommentController.getCommentList()}"/>
                        <div id="contented">
                            <div class="bg_account_T">
                                Quản Lý Bình Luận
                            </div>
                            <div class="box-profile">
                                <fieldset>
                                    <legend>Thông Tin Bình Luận</legend>
                                    <h:form >
                                        <h:commandButton value="Insert" action="insertcomment" />

                                    </h:form>

                                    <br /><br />
                                    <div class ="middle-box">
                                        <c:if test ="${not empty list}">

                                            <table class="table" cellpadding="0" cellspacing="0">
                                                <thead>
                                                    <tr>
                                                        <th>Mã Bình Luận</th>
                                                        <th>Sản phẩm</th>
                                                        <th>Username</th>
                                                        <th>Nội Dung</th>
                                                        <th>Action</th>

                                                    </tr>
                                                </thead>
                                                <tbody>
                                                    <c:forEach items ="${list}" var ="comment">
                                                        <tr>
                                                            <h:form>
                                                                <input type="hidden" name="txtID" value="#{comment.mabinhluan}"/>
                                                                <td><label >#{comment.mabinhluan}</label></td>
                                                                <td><label >#{comment.sanpham.tensanpham}</label></td>
                                                                <td><label >#{comment.thanhvien.username}</label></td>             
                                                                <td><label >#{comment.noidung}</label></td>
                                                                <td>
                                                                    <h:commandButton  value ="Delete" action="#{admin_CommentController.getCommentDelete()}" />
                                                                    <h:commandButton  value ="Update" action="#{admin_CommentController.getCommentUpdate}"/>

                                                                </td>

                                                            </h:form>
                                                        </tr>
                                                    </c:forEach>
                                                </tbody>
                                            </table>
                                            <form action="AdminController.do">
                                                <input type="submit" value ="CreateReport" name="action"/>
                                            </form>
                                        </c:if>
                                    </div>
                                </fieldset>
                            </div>
                        </div>
                    </div>
                </div>
            </ui:define>

        </ui:composition>

    </body>
</html>
